home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Applications / LightWayText 2.1.2E / Macro Sample / Macro Editor Manual < prev    next >
Encoding:
Text File  |  1999-02-11  |  22.2 KB  |  400 lines  |  [TEXT/LWTE]

  1. Macro Editor Manual
  2.  
  3.  1. About Macro Editor
  4.  Macro Editor is the tool which edits the macro-program of LightWayText. Macro is a script which the action of the character input, key operation, menu command describes a series of operation to and to carry out automatically.
  5.  Macro of LightWayText is the action of the character input, key operation, menu command described by "Record Key Macro" of Edit - Key Macro menu. And, that is the jump of the macro-inside, a calculation by the variable, the designation of the conditional sentence by the comparison, the indication of input dialog, and so on can describe it.
  6.  The made macro is registered for the Key Macro menu, and it can be carried out from the menu. And, the made macro can be assigned to Function key, too.
  7.  Macro Editor is indicated when "Macro Editor..." of the Edit - Key Macro menu of LightWayText is carried out.
  8.  
  9.      
  10.  
  11.  2. Basic behavior of Macro Editor
  12.  When Macro Editor is opened, it becomes new macro editing condition. When a record key macro is carried out in advance, key macro contents are indicated in the Macro Contents listbox. In the Macro Contents listbox, a macro command is indicated in order from No.1, a macro command is decided to be carried out in this number of the order. When a macro command is chosen from New Item popup menu, it is added to the Macro Contents listbox. The right of Macro Editor becomes a macro command editing area, then macro can be edited. It registers for the Key Macro menu when Macro Name is inputted and a "Renewal" button is pushed.
  13.  
  14.  2.1. Macro Name:
  15.  The Macro Name which does editing is indicated. When the macro which has already been registered is edited, Macro Name is chosen form  popup menu on the right of the editing frame of the Macro Name. When "New Macro" of popup menu is chosen, it becomes new macro preparation. When the Record Key Macro is carried out in advance, key macro contents are indicated in the Macro Contents listbox. Then, a macro name is inputted, and the new macro is registered. When a macro name is changed, the macro is registered with the new name.
  16.  
  17.  2.2. Macro Contents:
  18.  A macro command list to edit indicates a listbox. In the Macro Contents listbox, the command carried out is indicated, with a number is stuck in order form 1.
  19.  When item of the Macro Contents listbox is chosen, the condition of that macro command is indicated in the right macro command editing area of Macro Editor.
  20.  
  21.  2.3. New Item:
  22.  The  popup menu of the "New Item" is used, and a macro command is added to the macro command during editing. There are Menu, Enter String, Key Operation, Jump, Label, Variable, Compare, Find, Dialogue, Other in the macro command.
  23.  When a New Item is carried out, it is inserted behind chosen item in listbox.
  24.  When pushing Shift key and a New Item is carried out, it is inserted in front of chosen item in listbox.
  25.  When item of listbox isn't chosen, it is added at the end of the listbox most. Then, when a Shift key is being pushed, it is inserted in the beginning of listbox.
  26.  
  27.  2.4. Edit of Macro Contents Listbox (Cut, Copy, Paste, Clear)
  28.  Macro Contents Listbox can be edited by carrying out Cut, Copy, Paste, Clear command form Edit menu. Clear command is carried out with the delete key.
  29.  When Paste is carried out, it is inserted behind chosen item in listbox.
  30.  When pushing Shift key and Paste is carried out, it is inserted in front of chosen item in listbox.
  31.  When item of listbox isn't chosen, it is added at the end of the listbox most. Then, when a Shift key is being pushed, it is inserted in the beginning of listbox.
  32.  
  33.  2.5. Macro Option
  34.  An option that the made macro is assigned to Function key and to make not indicate it in the Key Macro menu can be specified.
  35.      Function Key
  36.         Macro is assigned to Function key from F1 to F15.
  37.         Function key is specified by inputting numerical value from 1 to 15.
  38.         When a bigger number the 15 is inputted, it isn't carried out.
  39.         And, Shift+Function key and Option+Function key can be specified.
  40.     Disable Menu View
  41.         It is specified not to indicate the macro in Edit - Key Macro menu.
  42.         It is used when it wants to set it up only in Function key.
  43.  
  44.  2.6. Read...
  45.  File Open Dialog is indicated, and a macro file such as a Macro Sample is read.
  46.  When the macro file is read, it registers for the Key Macro menu automatically, and macro contents are indicated on the editing screen of Macro Editor.
  47.  
  48.  2.7. Write...
  49.  File Save Dialog is indicated, and the macro during editing is written as a file.
  50.  A macro name becomes a file name as it is.
  51.  
  52.  2.8. Renewal
  53.  The macro during editing is renewed, Use makes it possible with LightWayText.
  54.  In the new macro case, it registers for Key Macro menu with the inputted macro name. And, when a macro name isn't being inputted, it becomes to carry it out in "Execute Key Macro" of the Key Macro menu. When there is a syntax error (the number of the place of a jump and a label don't exist) in the macro during editing, an alert is indicated, and macro modification is suggested.
  55.  
  56.  2.9. Macro Command Editing Area
  57.  When item in "Macro Contents" listbox is chosen or "New Item" popup menu is carried out, the condition of that command is indicated in the right macro command editing area of Macro Editor.
  58.  
  59.  3. Explanation of Macro Command
  60.  The macro command are Menu, Enter String, Key Operation, Jump, Label, Variable, Compare, Find, Dialogue, Other. And an editing screen varies according to those contents.
  61.  
  62.  3.1. Menu
  63.  A menu command is chosen directly form the real menu bar.
  64.      
  65.  Be sure to choose a menu under the condition that a "Macro Contents" listbox is surrounded by bold frame. When there is a cursor in the editing frame of "Macro Name", a menu can't be chosen.
  66.  
  67.  3.2. Enter String
  68.  The String which it wants to paste on LightWayText is inputted to the editing frame of the "String". About 10000 characters which contain a line feed code can be inputted.
  69.      
  70.  
  71.  3.3. Key Operation
  72.  The key operation of LightWayText is set up.
  73.      
  74.   Contents:
  75.     Cursor    Move left, rove Right, Move 1 line up, Move 1 line down
  76.             Move left of 1 word, Move right of 1 word, Move head of line
  77.             Move end of line, Move 1 page up, Move 1 page down
  78.             Move first line, Move last line
  79.     Scroll    Scroll left, Scroll right, Scroll 1 line up, Scroll 1 line down
  80.     Remove    Remove left 1 character, Remove right 1 character
  81.             Remove left of1 word, Remove right of 1 word
  82.             Remove to head of line, Remove until end of line
  83.             Remove one line, Undo remove line
  84.   Selection
  85.     A string selection (the movement of the Shift key) can be specified 
  86.     for the key operation of the cursor movement.
  87.   Count:
  88.     The repetition number of time of the key operation is specified.
  89.     Numerical value from 1 to 999 can be inputted to the editing frame.
  90.  
  91.  3.4. Jump
  92.  It jumps in the Macro Contents listbox, and the divergence of the macro command in done. This jump command is equivalent to the "goto" sentence of the programming language.
  93.      
  94.     Jump [Line#]        The line number of the Macro Contents listbox is specified.
  95.     Jump [Label]        The label name of the place of the jump is specified.
  96.     Quit            The macro execution is terminated.
  97.     Line# or Label:    When Jump [Line#]  Jump [Label] was specified, 
  98.                     Line# is inputted in the numerical value, 
  99.                     Label name is inputted in the character.
  100.  When I want it to jump in the line# of the editing cursor of LightWayText document, it is not this Jump command, "Go To Line#" in Other command is used.
  101.  
  102.  3.5. Label
  103.  As for Label, the name of the place of the jump of the jump command, and it is used for the description of the comment in the Macro Contents listbox. A label itself doesn't do treatment.
  104.      
  105.     Label:        A character inputs a label name to the editing frame.
  106.  
  107.  3.6. Variable
  108.   A variable is used when it wants to hold the calculation of the numerical value and a string during the macro execution. In the variable, there are a string variable and a integer variable, and it can be used respectively to 8 counts.
  109.  This variable is used with the command of Compare, Find, Dialogue, Other to explain later.
  110.      
  111.     Subject:    Variable (String var 1-8, Integer var 1-8) made the target
  112.             of the treatment in specified.
  113.     Do it:        Treatment toward the variable is specified.
  114.     Initialize            The contents of the variable are made 0 or null.
  115.     Paste            The contents of the variable paste on LightWayText.
  116.     substitution (=)    The variable is substituted for the "Contents" item.
  117.     addition (+)        The variable is added to the "Contents" item.
  118.     subtraction (-)        The variable is subtracted in the "Contents" item.
  119.     multiplication (*)    The variable is multiplied on the "Contents" item.
  120.     division (/)        The variable is divided by the "Contents" item.
  121.     surplus (%)        The variable is surplus divided by the "Contents" item.
  122.     Contents:    Treatment is done as, when treatment object is string variable, 
  123.             contents are string value, and, when treatment object is integer 
  124.             variable, contents are integer value.
  125.     Nothing                    Treatment toward the variable isn't done.
  126.     String or Integer            The string or integer input to editing frame.
  127.     Letter of cursor position        The letter (character) of cursor position.
  128.     String of cursor line        The string of cursor line is specified.
  129.     String of selection            The string of selection is specified.
  130.     Line# of cursor position        The line # of cursor position is specified.
  131.     Letter# of cursor position    The letter# of cursor position is specified.
  132.     String count of cursor line    The string count of cursor line is specified.
  133.     Line# of selection end        The line # of selection end is specified.
  134.     Letter# of selection end        The letter# of selection end is specified.
  135.     String count of selection        The string count of selection is specified.
  136.                             It is 0 when it isn't selected string.
  137.     Line# of last line            The last (maximum) line number is specified.
  138.     String var 1-8                The string variable 1-8 is specified.
  139.     Integer var 1-8            The integer variable 1-8 is specified.
  140.  
  141.     A cursor position is a selection start position (the upper left of the 
  142.     selection range) at the time of the selection condition.
  143.     A selection end position is on the bottom right of the selection range.
  144.     When object are string variable and contents are integer value,
  145.     it is done as string value at integer value.
  146.     When object are integer variable and contents are string value,
  147.     it is done as integer value at if string is the character of 0-9, and, 
  148.     it is done with it as 0 at the time of the string except for it.
  149.  
  150.  3.7. Compare
  151.  The treatment of the conditional sentence by the comparison is done during the macro practice. When comparison is right or it is wrong, a jump command can be specified in each.
  152.  
  153.      
  154.     Subject:    The item made the target of the comparison is specified.
  155.     Nothing                    Compare toward the variable isn't done.
  156.     Letter of cursor position        The letter (character) of cursor position.
  157.     String of cursor line        The string of cursor line is specified.
  158.     String of selection            The string of selection is specified.
  159.     Line# of cursor position        The line # of cursor position is specified.
  160.     Letter# of cursor position    The letter# of cursor position is specified.
  161.     String count of cursor line    The string count of cursor line is specified.
  162.     Line# of selection end        The line # of selection end is specified.
  163.     Letter# of selection end        The letter# of selection end is specified.
  164.     String count of selection        The string count of selection is specified.
  165.                             It is 0 when it isn't selected string.
  166.     Line# of last line            The last (maximum) line number is specified.
  167.     String var 1-8                The string variable 1-8 is specified.
  168.     Integer var 1-8            The integer variable 1-8 is specified.
  169.     Sign:        A condition toward the comparison is specified.
  170.     Equal (==)                When subject and object is equal.
  171.     Differ (!=)                When subject and object is differ.
  172.     Equal greater than (>=)    When subject is equal or greater than object.
  173.     Equal less than (<=)        When subject is equal or less than object.
  174.     Greater than (>)        When subject is greater than object.
  175.     Less than (<)            When subject is less than object.
  176.     Object:        Compare is done as, when Compare subject is string variable, 
  177.             object are string value, and, when Compare subject is integer 
  178.             variable, object are integer value.
  179.     Nothing                    Compare object is specified by 0 value.
  180.     String or Integer            The string or integer input to editing frame.
  181.     Letter of cursor position        The letter (character) of cursor position.
  182.     String of cursor line        The string of cursor line is specified.
  183.     String of selection            The string of selection is specified.
  184.     Line# of cursor position        The line # of cursor position is specified.
  185.     Letter# of cursor position    The letter# of cursor position is specified.
  186.     String count of cursor line    The string count of cursor line is specified.
  187.     Line# of selection end        The line # of selection end is specified.
  188.     Letter# of selection end        The letter# of selection end is specified.
  189.     String count of selection        The string count of selection is specified.
  190.                             It is 0 when it isn't selected string.
  191.     Line# of last line            The last (maximum) line number is specified.
  192.     String var 1-8                The string variable 1-8 is specified.
  193.     Integer var 1-8            The integer variable 1-8 is specified.
  194.  
  195.     A cursor position is a selection start position (the upper left of the 
  196.     selection range) at the time of the selection condition.
  197.     A selection end position is on the bottom right of the selection range.
  198.     When object are string variable and contents are integer value,
  199.     it is compare as string value at integer value.
  200.     When object are integer variable and contents are string value,
  201.     it is compare as integer value at if string is the character of 0-9, and, 
  202.     it is compare with it as 0 at the time of the string except for it.
  203.  
  204.     Right Compare:    When the result of the comparison is right, jump is done.
  205.     Nothing        Nothing is done.
  206.     Jump [Line#]    The line number of the Macro Contents listbox is specified.
  207.     Jump [Label]    The label name of the place of the jump is specified.
  208.     Quit            The macro execution is terminated.
  209.     Wrong Compare:    When the result of the comparison is wrong, jump is done.
  210.     Nothing        Nothing is done.
  211.     Jump [Line#]    The line number of the Macro Contents listbox is specified.
  212.     Jump [Label]    The label name of the place of the jump is specified.
  213.     Quit            The macro execution is terminated.
  214.  
  215.  3.8. Find
  216.  The Find can be done by using the string variable during the macro practice.
  217.  When find is success or it is failure, a jump command can be specified in each.
  218.      
  219.     Subject:        The item made the target of the find is specified.
  220.     String            A string is inputted to the editing frame.
  221.     String var 1-8        The string variable 1-8 are specified. It is looked up 
  222.                     with the contents of the string variable.
  223.     Ignore J-Roman letters    (Japanese script font only)
  224.                     Japanese 2 byte roman, 1 byte roman letters is set up 
  225.                     whether it is equated, or it is distinguished.
  226.     Ignore J-Kana letters    (Japanese script font only)
  227.                     Japanese hiragana, japanese katakana letters is set up 
  228.                     whether it is equated, or it is distinguished.
  229.     Ignore Upper/Lower case
  230.                     A upper case, lower case  (capital letter, small letter) 
  231.                     is set up whether it is equated, or it is distinguished.
  232.     Find Backwards    It is set up whether it is search in backward direction.
  233.     Regular Expression    Find by the regular expression is set up.
  234.     Refer to "5. Regular Expression" of LightWayText Manual for the details.
  235.  
  236.     Success Find:    When the result of the find is success, jump is done.
  237.     Nothing        Nothing is done.
  238.     Jump [Line#]    The line number of the Macro Contents listbox is specified.
  239.     Jump [Label]    The label name of the place of the jump is specified.
  240.     Quit            The macro execution is terminated.
  241.     Failure Find:        When the result of the find is failure, jump is done.
  242.     Nothing        Nothing is done.
  243.     Jump [Line#]    The line number of the Macro Contents listbox is specified.
  244.     Jump [Label]    The label name of the place of the jump is specified.
  245.     Quit            The macro execution is terminated.
  246.  
  247.  3.9. Dialogue
  248.  The dialogue of the input of character, integer value which "Input Dialog" was used for, and the message indication by the alert is done. When dialogue is OK or it is Cancel, a jump command can be specified in each.
  249.      
  250.     Input Dialog        Input Dialog is specified.
  251.     Alert View        Alert View is specified.
  252.     Message:        A message is inputted to the editing frame.
  253.                 When it isn't inputted, a message indicates the contents of 
  254.                 the string variable specified in the subject as a message.
  255.     Subject:        The variable that the string inputted with Input Dialog is 
  256.                 stored is specified.
  257.     String var 1-8        A string is stored in the string variable.
  258.     Integer var 1-8    A integer value is stored in the integer variable.
  259.  
  260.     Dialogue is OK:    When dialogue is OK, a jump command is done.
  261.     Nothing        Nothing is done.
  262.     Jump [Line#]    The line number of the Macro Contents listbox is specified.
  263.     Jump [Label]    The label name of the place of the jump is specified.
  264.     Quit            The macro execution is terminated.
  265.     Dialogue is Cancel:    When dialogue is Cancel, a jump command is done.
  266.     Nothing        Nothing is done.
  267.     Jump [Line#]    The line number of the Macro Contents listbox is specified.
  268.     Jump [Label]    The label name of the place of the jump is specified.
  269.     Quit            The macro execution is terminated.
  270.  
  271.  3.10. Other
  272.  The treatment of the setup and the acquisition of the condition of LightWayText was arranged as Other commands.
  273.      
  274.  
  275.     Contents:
  276.       Nothing            Nothing is done.
  277.       Switch Next Window    Next window is made the condition of it can be edited.
  278.       Switch Prev Window    Prev window is made the condition of it can be edited.
  279.  
  280.     The next and previous of the window become the turns of the document 
  281.     name indicated in the Window menu. When a string variable is specified in 
  282.     the subject, the window name which specified the contents of the string 
  283.     variable as a document name is made the condition that it can be edited.
  284.     It is made the condition that that document is opened and it can be edited if
  285.     the document name list of the Recent menu is referred to and found when 
  286.     the window of the specified name isn't open.
  287.  
  288.       Go To Line#        A line number jumps with the contents of the integer 
  289.                     variable specified in the subject.
  290.       Set Document Name    The contents of the string variable specified in the 
  291.                     subject are made a document name.
  292.       Get Document Name    A document name is stored in the string variable 
  293.                     specified in the subject.
  294.       Get Today Date        A date is stored in the string variable specified in the 
  295.                     subject. When a integer variable is specified in the 
  296.                     subject, it is stored with this form.
  297.                     (Example) 1998.01.05 (Mon) -> 199801052
  298.                         The rightmost 1 digit of the value is 1:Sunday,
  299.                         2:Monday, , ,7:Saturday
  300.       Get Now Time        A time is stored in the string variable specified in the 
  301.                     subject. When a integer variable is specified in the 
  302.                     subject, it is stored with this form.
  303.                     (Example) 4 : 25 PM  ->  162500
  304.                         The rightmost 2 digits of the value become from 
  305.                         00 to 59 by the number of second.
  306.       Restart Line#        A line number starts with the contents of the integer 
  307.                     variable specified in the subject.
  308.       Clear Line#        A line number is cleared with the contents of the 
  309.                     integer variable specified in the subject.
  310.                     When nothing is specified in the subject, a line number 
  311.                     start, line number is cleared on the present cursor line 
  312.                     of LightWayText.
  313.  
  314.     Subject:        The variable that Other command using is specified.
  315.     String var 1-8        The string variable 1-8 is specified.
  316.     Integer var 1-8    The integer variable 1-8 is specified.
  317.  
  318.  
  319.  4. Remove the Registered Macro
  320.  When the registered macro is removed from LightWayText, "Define Key Macro..." of the Edit - Key Macro menu is carried out and removed with Define Key Macro Dialog.
  321.      
  322.  
  323.  
  324.  5. Macro Creation Example
  325.  It is made to explain a macro creation example by the indication form of Macro Contents listbox.
  326.  
  327.  (Example 1)    The space at the end of the line is removed.
  328.  The macro which removes space code and tab code at the end of all the lines inside the document.
  329.     1   Key Operation    Move first line
  330.     2   Label        loop1
  331.     3   Find        [ \t]+$+R (Failure) Quit
  332.     4   Key Operation    Remove left 1 character
  333.     5   Jump        Label: loop1
  334.  
  335.  (Example 2)    With the selection string, "Find/Replace..." is carried out.
  336.  The macro which makes a selection string a find object by "Find/Replace..."
  337.     1   Compare        String count of selection == 0 (Right) Label: skip1
  338.     2   Menu        Find Selection
  339.     3   Label        skip1
  340.     4   Menu        Find/Replace...
  341.  
  342.  (Example 3)    Paste Date
  343.  The macro which pastes today's date on LightWayText
  344.     1   Other        Get Today Date + String var 1
  345.     2   Variable        String var1Paste
  346.  
  347.  (Example 4)    A date is pasted at "Heisei"
  348.  A macro which today's date is changed into in "Heisei" from A.D. and paste on LightWayText
  349.     1   Other        Get Today Date + Integer var 1
  350.     2   Enter String    Heisei
  351.     3   Variable        Integer var 2 = Integer var 1
  352.     4   Variable        Integer var 2 / 100000
  353.     5   Variable        Integer var 2 - 1988
  354.     6   Variable        Integer var 2Paste
  355.     7   Enter String    Nen
  356.     8   Variable        Integer var 2 = Integer var 1
  357.     9   Variable        Integer var 2 / 1000
  358.     10  Variable        Integer var 2 % 100
  359.     11  Variable        Integer var 2Paste
  360.     12  Enter String    Gatu
  361.     13  Variable        Integer var 2 = Integer var 1
  362.     14  Variable        Integer var 2 / 10
  363.     15  Variable        Integer var 2 % 100
  364.     16  Variable        Integer var 2Paste
  365.     17  Enter String    Nichi
  366.  
  367.  (Example 5)    The sort of the line of the selection range
  368.  The macro which rearranges the line of the selection range in little order.
  369.     1   Variable        Integer var 1 = Line# of cursor position
  370.     2   Variable        Integer var 2 = Line# of selection end
  371.     3   Compare        Integer var 1 == Integer var 2 (Right) Quit
  372.     4   Label        loop1
  373.     5   Variable        String var 1 = String of cursor line
  374.     6   Variable        Integer var 3 = Integer var 1
  375.     7   Variable        Integer var 4Initialize
  376.     8   Label        loop2
  377.     9   Compare        Integer var 3 >= Integer var 2 (Right) Label: skip1
  378.     10  Variable        Integer var 3 + 1
  379.     11  Other        Go To Line# + Integer var 3
  380.     12  Compare        String of cursor line >= String var 1 (Right)Label:loop2
  381.     13  Variable        String var 2 = String of cursor line
  382.     14  Key Operation    Remove one line
  383.     15  Variable        String var 1Paste
  384.     16  Key Operation    Move 1 line up
  385.     17  Variable        String var 1 = String var 2
  386.     18  Variable        Integer var 4 = 1
  387.     19  Jump        Label: loop2
  388.     20  Label        skip1
  389.     21  Other        Go To Line# + Integer var 1
  390.     22  Compare        Integer var 4 == 0 (Right) Label: skip2
  391.     23  Key Operation    Remove one line
  392.     24  Variable        String var 1Paste
  393.     25  Key Operation    Move 1 line up
  394.     26  Label        skip2
  395.     27  Variable        Integer var 1 + 1
  396.     28  Key Operation    Move 1 line down
  397.     29  Compare        Integer var 1 < Integer var 2 (Right) Label: loop1
  398.  
  399.  
  400.